package cn.gudian.cms.Rss

import cn.gudian.cms.News.Article
import cn.gudian.cms.System.Sys

class RssController {

  def feed = {
    render(feedType: "rss", feedVersion: "2.0") {
      title = Sys.getValue("SITE_NAME");
      link = "http://www.yndongyi.com/rss/feed"
      description = Sys.getValue("SITE_DESCRIPTION")
      def articleInstanceList = Article.findAll("from Article  where arc_type_id in(select id from ArcType where mode=?) and ismake=true order by orderNum desc", ["Article"]);

      articleInstanceList.each() { article ->
        entry(article.title) {
          link = "http://www.yndongyi.com/c/shownew/${article.id}"
          publishedDate = article.pubdate
          content() {
            type = "text/html"
            article.body
          }
        }
      }

    }

  }
}
